<link href="__ADMIN__/css/juncms.min2.css?v=1" rel="stylesheet" type="text/css" />  



<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	
	<!-- END RIBBON -->
	<div class="content">
		<div class="panel panel-default panel-intro">
			<div class="panel-heading">
				<div class="panel-lead">
					<em>
						权限菜单管理
					</em>
					从左侧菜单选择，可以对菜单进行CURD操作。
				</div>
			</div>
			<div class="panel-body">
				<div id="myTabContent" class="tab-content">
					<div class="tab-pane fade active in" id="one">
						<div class="widget-body no-padding">
							<div class="bootstrap-table">


                                    <div class="org-left-col tray-cell j_depa" style="float:left;margin-right: 10px">
                                        <div class="org-left-header">
                                            <span class="tab">
                                                <a id="organization-users" class="router j_user active">
                                                    权限菜单
                                                </a>
                                            </span>
                                        </div>
                                        <a id="show-first-group" class="hide router">
                                        </a>
                                        <div id="org-tree" class="org-tree scrollwrapper mCustomScrollbar _mCS_24 mCS_no_scrollbar">
                                            <div id="mCSB_24" class="mCustomScrollBox mCS-darkblue mCSB_vertical_horizontal mCSB_inside" >
                                                <div id="mCSB_24_container_wrapper">
                                                    <div id="mCSB_24_container" class="mCSB_container" style="position: relative; top: 0px; left: 0px; width: 100%; overflow: hidden; overflow-y: auto" >
                                                        <div id="org-tree-list" class="mt-15">
                                                            <ul>
                                                                <li>
                                                                    <div class="treenode router root selected" style="padding-left:20px"  >
                                                                        {if condition="$adminController->vif('menu','add')"}
                                                                            <span class="actions j_psStatus">
                                                                                <a class="router" onclick="add('{:url('menu/add')}');"><i class="icon-plus-thin"></i></a>
                                                                            </span>
                                                                        {/if}
                                                                        <span class="num j_numps fr">{$num}</span>
                                                                        <a class="router j_undefined" href="{:url('menu/index', ['pid'=>0])}"><span class="tree-name">顶级权限</span></a>
                                                                    </div>
    
                                                                    <ul class="ftl-child-ul">
                                                                    {volist name="json" id="v"}
                                                                        <li class="del-{$v.id}">
                                                                            <div class="treenode router" style="padding-left:40px">
                                                                                <span class="actions j_psStatus">
                                                                                    {if condition="$adminController->vif('menu','upd')"}<a class="router" onclick="upd('{:url('menu/upd', ['pid'=>$v['id']])}');" title="编辑"><i class="icon-edit"></i></a>{/if}
                                                                                    {if condition="$adminController->vif('menu','add')"}<a class="router" onclick="add('{:url('menu/add', ['pid'=>$v['id']])}');" title="添加下级权限"><i class="icon-plus-thin"></i></a>{/if}
                                                                                    {if condition="$adminController->vif('menu','del')"}<a class="router del_menu" data-id="{$v.id}" title="删除权限"><i class="icon-trash"></i></a>{/if}
                                                                                </span>
                                                                                <span class="num j_numps fr">{$v.num}</span>
                                                                                <a class="router j_undefined" href="{:url('menu/index', ['pid'=>$v['id']])}"><span class="tree-name">{$v.name}</span></a>
                                                                            </div>
                                                                            {volist name="v.children" id="vv"}
                                                                            <ul class="ftl-child-ul">
                                                                                <li class="del-{$vv.id}">
                                                                                    <div class="treenode router" style="padding-left:60px">
                                                                                        <span class="actions j_psStatus">
                                                                                            {if condition="$adminController->vif('menu','upd')"}<a class="router" onclick="upd('{:url('menu/upd', ['pid'=>$vv['id']])}');" title="编辑"><i class="icon-edit"></i></a>{/if}
                                                                                            {if condition="$adminController->vif('menu','add')"}<a class="router" onclick="add('{:url('menu/add', ['pid'=>$vv['id']])}');" title="添加下级权限"><i class="icon-plus-thin"></i></a>{/if}
                                                                                            {if condition="$adminController->vif('menu','del')"}<a class="router del_menu" data-id="{$vv.id}" title="删除权限"><i class="icon-trash"></i></a>{/if}
                                                                                        </span>
                                                                                        <span class="num j_numps fr">{$vv.num}</span>
                                                                                        <a class="router j_undefined" href="{:url('menu/index', ['pid'=>$vv['id']])}"><span class="tree-name">{$vv.name}</span></a>
                                                                                    </div>
                                                                                    {volist name="vv.children" id="vvv"}
                                                                                    <ul class="ftl-child-ul">
                                                                                        <li class="del-{$vvv.id}">
                                                                                            <div class="treenode router" style="padding-left:80px">
                                                                                                <span class="actions j_psStatus">
                                                                                                    {if condition="$adminController->vif('menu','upd')"}<a class="router" onclick="upd('{:url('menu/upd', ['pid'=>$vvv['id']])}');" title="编辑"><i class="icon-edit"></i></a>{/if}
                                                                                                    {if condition="$adminController->vif('menu','add')"}<a class="router" onclick="add('{:url('menu/add', ['pid'=>$vvv['id']])}');" title="添加下级权限"><i class="icon-plus-thin"></i></a>{/if}
                                                                                                    {if condition="$adminController->vif('menu','del')"}<a class="router del_menu" data-id="{$vvv.id}" title="删除权限"><i class="icon-trash"></i></a>{/if}
                                                                                                </span>
                                                                                                <span class="num j_numps fr">{$vvv.num}</span>
                                                                                                <a class="router j_undefined" href="{:url('menu/index', ['pid'=>$vvv['id']])}"><span class="tree-name">{$vvv.name}</span></a>
                                                                                            </div>
                                                                                        </li>
                                                                                    </ul>
                                                                                    {/volist}
                                                                                </li>
                                                                            </ul>
                                                                            {/volist}
                                                                        </li>
                                                                    {/volist}
                                                                    </ul>
                                                                </li>
                                                            </ul>
                                                                        
                                                                        
                                                                    
                                                        </div>
                                                        
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>



								<div class="fixed-table-toolbar" style="width:-webkit-calc(100% - 310px); width:-moz-calc(100% - 310px); width:calc(100% - 310px);float: left;">
									<div class="bs-bars pull-left">
										<div id="toolbar" class="toolbar">
											<a href="javascript:window.location.reload();" class="btn btn-primary btn-refresh" title="刷新">
												<i class="fa fa-refresh"></i>
                                            </a>
                                            {if condition="$adminController->vif('menu','add')"}
											<a href="javascript:add('{:url('menu/add')}');" class="btn btn-success btn-add" title="添加">
												<i class="fa fa-plus"></i> 添加
                                            </a>
                                            {/if}
                                            <a href="javascript:icon('{:url('menu/icon')}');" class="btn btn-success btn-add" title="ICON">Icon参考表</a>
										</div>
									</div>
									<div class="columns columns-right btn-group pull-right">
										
										<div class="keep-open btn-group" title="列">
											<button type="button" aria-label="columns" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
												<i class="glyphicon glyphicon-th icon-th"></i>
												<span class="caret"></span>
											</button>
											<ul class="dropdown-menu" id="table_menu">
												
											</ul>
										</div>
                                        
									</div>
								</div>
								<div class="fixed-table-container" style="width:-webkit-calc(100% - 310px); width:-moz-calc(100% - 310px); width:calc(100% - 310px);float: left;">
									<div class="fixed-table-body">
										<div class="fixed-table-loading" style="top: 42px; display: none;">
											正在努力地加载数据中，请稍候……
										</div>
										<table id="table" class="table table-striped table-bordered table-hover"
										data-operate-edit="1" data-operate-del="1" width="100%">
											<thead>
												<tr>
                                                    <th data-status="0"><div class="th-inner">ID</div></th>
                                                    <th data-status="1"><div class="th-inner">对应版本</div></th>
                                                    <th data-status="1"><div class="th-inner">菜单名称</div></th>
                                                    <th data-status="1"><div class="th-inner">入口名称</div></th>
                                                    <th data-status="1"><div class="th-inner">控制器</div></th>
                                                    <th data-status="1"><div class="th-inner">方法</div></th>
                                                    <th data-status="1"><div class="th-inner">显示</div></th>
                                                    <th data-status="1"><div class="th-inner">状态</div></th>
                                                    <th data-status="1"><div class="th-inner">类型</div></th>
                                                    <th data-status="1" width="60px"><div class="th-inner">排序</div></th>
                                                    <th data-status="1" width="100px"><div class="th-inner">操作</div></th>
												</tr>
											</thead>
                                            
											<tbody>
                                                {volist name="list" id="v"}
                                                <tr class="del-{$v.m_id}">
                                                    <td align="center">{$v.m_id}</td>
                                                    <td align="center">{$v.e_edition}</td>
                                                    <td align="center"><a>{$v.m_name}</a></td>
                                                    <td align="center"><a>{$v.m_app|default='无'}</a></td>
                                                    <td align="center"><a>{$v.m_controller|default='无'}</a></td>
                                                    <td align="center"><a>{$v.m_action|default='无'}</a></td>
                                                    <td align="center">
                                                        {switch name="v.m_display"}
                                                            {case value="1"}显示{/case}
                                                            {case value="2"}<font color="red">隐藏</font>{/case}
                                                        {/switch}
                                                    </td>
                                                    <td align="center">
                                                        {switch name="v.m_status"}
                                                            {case value="1"}开启{/case}
                                                            {case value="2"}<font color="red">禁用</font>{/case}
                                                        {/switch}
                                                    </td>
                                                    <td align="center">
                                                        {switch name="v.m_type"}
                                                            {case value="1"}认证{/case}
                                                            {case value="2"}<font color="red">公共</font>{/case}
                                                        {/switch}
                                                    </td>
                                                    <td align="center"><a>{$v.m_sort}</a></td>
                                                    <td align="center">
                                                        {if condition="$adminController->vif('menu','add')"}
                                                            <a href="javascript:add('{:url('menu/add', ['pid'=>$v['m_id']])}');"><button class="btn btn-xs btn-info" title="添加"><i class="fa fa-plus"></i></button></a>
                                                        {/if}
                                                        {if condition="$adminController->vif('menu','upd')"}
                                                        <a href="javascript:upd('{:url('menu/upd', ['pid'=>$v['m_id']])}');" class="btn btn-xs btn-success btn-editone" title="编辑">
                                                            <i class="fa fa-pencil"></i>
                                                        </a>
                                                        {/if}
                                                        {if condition="$adminController->vif('menu','del')"}
                                                        <button data-id="{$v.m_id}" class="btn btn-xs btn-danger btn-delone del_menu" title="删除">
                                                            <i class="fa fa-trash"></i>
                                                        </button>
                                                        {/if}
                                                    </td>
                                                </tr>
                                                {/volist}
                                                
											</tbody>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

								
<script>
layui.use(['form'], function(){
  var form = layui.form,laydate = layui.laydate;
});
// icon
function icon(href) {
	layer.open({
		type: 2,
		title: 'Icon参考表',
		shadeClose: true,
		shade: false,
		maxmin: true,
		area: ['100%', '100%'],
		content: href
	});
}
// 添加
function add(href) {
	layer.open({
		type: 2,
		title: '添加新菜单',
		shadeClose: true,
		shade: false,
		maxmin: true,
		area: ['800px', '100%'],
		btn: ['确认', '取消'],
		content: href,
		yes: function(index, layero) {
			var _this = layero.find('iframe')[0];
			var bool  = _this.contentWindow.doSubimt();
			if (bool !== false) {
				$.thinkmimi({Content : bool['msg'],Type : 1,Align:'right',OutTime:2000,});
				menu_run();
				layer.closeAll();
				window.setTimeout(function(){
					window.location.reload();
				}, 700);
			}
		},
	});
}
// 修改
function upd(href) {
	layer.open({
		type: 2,
		title: '修改权限菜单',
		shadeClose: true,
		shade: false,
		maxmin: true,
		area: ['800px', '100%'],
		btn: ['确认', '取消'],
		content: href,
		yes: function(index, layero) {
			var _this = layero.find('iframe')[0];
			var bool  = _this.contentWindow.doSubimt();
			if (bool !== false) {
				$.thinkmimi({Content : bool['msg'],Type : 1,Align:'right',OutTime:2000,});
				menu_run();
				layer.closeAll();
				window.setTimeout(function(){
					window.location.reload();
				}, 700);
			}
		},
	});
}
// 删除
$(".del_menu").on('click', function(){
    if (confirm('确认删除吗')) {
        var id   = $(this).attr('data-id');
        var data = {'id':id};

        $.ajax({
            type: 'post',
            data:data,
            url: "{:url('menu/del')}",
            success: function(data) {
                var array = eval('('+data+')');
				if (array['code'] == '01') {
					$.thinkmimi({Content : array['msg'], Type:2, Align:'right', OutTime:2000});
				} else {
					$.thinkmimi({Content : array['msg'], Type:1, Align:'right', OutTime:2000});
					$('.del-'+id).remove();
				}
            }
        });
    }
});
</script>